package com.mdx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mdx.bean.DiseaseBean;
import com.mdx.dao.DiseaseDao;
import com.mdx.service.IBlightService;
import com.mdx.service.IDiseaseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class DiseaseServiceImpl extends ServiceImpl<DiseaseDao, DiseaseBean> implements IDiseaseService {
    @Override
    public IPage<DiseaseBean> findByNameSigns(int pageNO, int pageSize, String diseaseName, String onsetSigns) {
        IPage<DiseaseBean> page = new Page<>(pageNO,pageSize);
        QueryWrapper wrapper = new QueryWrapper();
        if (diseaseName != null && !diseaseName.equals("")){
            wrapper.like("f_diseaseName",diseaseName);
        }
        if (onsetSigns != null && !onsetSigns.equals("")){
            wrapper.like("f_onsetSigns",onsetSigns);
        }
        IPage<DiseaseBean> iPage = this.page(page,wrapper);
        return iPage;
    }
}
